home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # preinst script for cups
- #
- # see: dh_installdeb(1)
-
- set -e
-
- # summary of how this script can be called:
- # * <new-preinst> `install'
- # * <new-preinst> `install' <old-version>
- # * <new-preinst> `upgrade' <old-version>
- # * <old-preinst> `abort-upgrade' <new-version>
-
- mv_conffile() {
- OLD="$1"
- NEW="$2"
- PKGNAME="cupsys"
- if [ -e "$OLD" ]; then
- md5sum=$(md5sum "$OLD" | sed -e 's/ .*//')
- old_md5sum=$(dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e "\\' $OLD'{s/ obsolete$//;s/.* //p}")
- if [ "$md5sum" = "$old_md5sum" ]; then
- echo "Removing obsolete unchanged $OLD..." >&2
- rm -f "$OLD"
- else
- echo "Moving customized $OLD to new location $NEW..." >&2
- mv -f "$OLD" "$NEW"
- fi
- fi
- }
-
- case "$1" in
- install|upgrade)
- if [ -e /var/lib/cups/ppd -a ! -L /var/lib/cups/ppd -a ! -e /etc/cups/ppd ]; then
- echo -n "Moving printer definition files..."
- mkdir -p /etc/cups/ppd || true
- if [ `ls /var/lib/cups/ppd | wc -l` -ne " 0" ]; then
- cp -a /var/lib/cups/ppd/* /etc/cups/ppd
- fi
- rm -rf /var/lib/cups/ppd
- echo "done."
- fi
-
- if [ -e /var/lib/cups/logs -a ! -L /var/lib/cups/logs ]; then
- rmdir /var/lib/cups/logs || true
- fi
-
- # Remove dangling pdftops.conf symlink, which is obsolete anyway
- if [ -L /etc/cups/pdftops.conf -a ! -e /etc/cups/pdftops.conf ]; then
- rm -f /etc/cups/pdftops.conf
- fi
-
- # fix 'cupsys' -> 'root' file owner mode transition
- if dpkg --compare-versions "$2" lt-nl '1.3.0-3'; then
- if [ -d /var/run/cups ]; then
- chown -R root /var/run/cups
- fi
- chown -R root /etc/cups /var/log/cups /var/cache/cups /var/spool/cups
- fi
-
- # cupsys -> cups package/file rename
- if dpkg --compare-versions "$2" le '1.3.7-7'; then
- update-rc.d -f cupsys remove
- mv_conffile /etc/default/cupsys /etc/default/cups
- mv_conffile /etc/init.d/cupsys /etc/init.d/cups
- mv_conffile /etc/pam.d/cupsys /etc/pam.d/cups
- mv_conffile /etc/logrotate.d/cupsys /etc/logrotate.d/cups
- fi
-
- # does not need d-bus configuration, only sends signals
- if dpkg --compare-versions "$2" lt-nl '1.3.9-16'; then
- rm -f /etc/dbus-1/system.d/cups.conf
- fi
-
- # Obsolete symlinks, and they wreak havoc now
- if dpkg --compare-versions "$2" lt-nl '1.4.0-6'; then
- rm -f /usr/share/ppd/1-local-admin /usr/share/ppd/2-third-party
- fi
-
- # blacklist was installed for some weeks (intra-squeeze and karmic),
- # remove it again (now USB backend works with both)
- if dpkg --compare-versions "$2" lt-nl '1.4.1-4'; then
- rm -f /etc/modprobe.d/blacklist-cups.conf
- fi
- ;;
-
- abort-upgrade)
- ;;
-
- *)
- echo "preinst called with unknown argument \`$1'" >&2
- exit 0
- ;;
- esac
-
- # dh_installdeb will replace this with shell code automatically
- # generated by other debhelper scripts.
-
-
-
- exit 0
-
-
-